# 从flask这个包中导入Flask类
import os

from flask import Flask, session
from flask_migrate import Migrate

from blueprints.admin_manage import admin
from blueprints.auth import bp
from blueprints.book_manage import book_bp
from blueprints.Usr import usr
from models import UserModel
from models import BookModel
from models import ClassifierModel
from exts import db
import config



app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)
migrate = Migrate(app, db)
app.register_blueprint(bp)
app.register_blueprint(book_bp)
app.register_blueprint(admin)
app.register_blueprint(usr)
app.config['SECRET_KEY'] = os.urandom(24)
app.config['SESSION_TYPE'] = 'filesystem'

if __name__ == '__main__':
    app.config['JSON_AS_ASCII'] = False
    app.run(debug=True)
